Skip to content

Show canonical ACL overlap remediation as a green status line, not a yellow warning - #45

Merged
Joel Platek (VAsHachiRoku) merged 2 commits into
mainfrom
fix/canonical-remediation-message
Aug 24, 2026
Merged

Show canonical ACL overlap remediation as a green status line, not a yellow warning#45
Joel Platek (VAsHachiRoku) merged 2 commits into
mainfrom
fix/canonical-remediation-message

Conversation

@VAsHachiRoku

Copy link
Copy Markdown
Contributor

Summary

Improves the terminal output during OU deployment: the canonical-ACL overlap notice is now a concise green status line instead of a long yellow WARNING.

Background

When New-TierModelOu disables inheritance on a Tier OU and re-sorts the DACL into canonical order, Repair-TierModelCanonicalAcl checks for an explicit Deny and Allow for the same principal with overlapping rights (a legitimate, common pattern — e.g. Exchange Trusted Subsystem). Previously it emitted a yellow WARNING: line per overlapping pair, per OU. On a domain with an inherited Deny, a successful deployment of ~7 OUs produced a wall of alarming yellow text — even though the remediation worked correctly and is expected behavior.

Change

  • Emit a single green line per OU:
    REMEDIATED: Canonical ACL overlap on OU: <name> (deduplicated, one per OU).
  • The detailed per-principal entry (DN + principal) is still recorded in the result's Warnings array for logging/audit — only the terminal presentation changed.
  • No change to the sort or repair logic.

Tests

Two overlap tests in tests/Unit.CanonicalAclRepair.Tests.ps1 updated to assert on the result's Warnings array (the notice is no longer on the warning stream). Full suite: 1,627 passing, 0 failing; coverage unchanged (~91% on the module scope).

Notes

Visual/UX only — no functional or version-affecting change. Independent of the .gitattributes line-ending fix (separate branch/PR).

…yellow warning

When OU disable-inheritance remediation re-sorts a DACL that contains an
explicit Deny and Allow for the same principal (e.g. Exchange Trusted
Subsystem), Repair-TierModelCanonicalAcl previously emitted a long yellow
WARNING per overlapping pair per OU ? a wall of alarming text during an
expected, successful operation.

Replace that with a single green "REMEDIATED: Canonical ACL overlap on OU:
<name>" line per OU (deduplicated). The detailed per-principal entry (DN +
principal) is still recorded in the result's Warnings array for logging and
audit. Visual/UX change only ? no change to the sort or repair logic. Two
overlap tests updated to assert on the result's Warnings array instead of the
warning stream. Full suite 1627/0.
Copilot AI lite review requested due to automatic review settings August 24, 2026 06:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the operator-facing output for canonical ACL overlap remediation during OU deployment: instead of emitting repeated yellow WARNING: lines on the warning stream, it now prints a single green remediation status line per OU while still recording detailed overlap entries in the returned result’s Warnings array.

Changes:

  • Updated Repair-TierModelCanonicalAcl to deduplicate terminal output for Deny/Allow overlap scenarios and to store overlap details in Warnings without writing to the warning stream.
  • Updated overlap-related unit tests to assert against the result’s Warnings array instead of -WarningVariable.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
modules/TierModel/public/Repair-TierModelCanonicalAcl.ps1 Changes overlap reporting from warning-stream output to a single green status line + structured Warnings entries.
tests/Unit.CanonicalAclRepair.Tests.ps1 Updates overlap tests to validate the Warnings array rather than capturing warning-stream output.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +198 to +202
if (-not $printedOverlapNotice) {
$ouLeaf = if ([string]::IsNullOrEmpty($DistinguishedName)) { $DistinguishedName } else { (($DistinguishedName -split ',')[0] -replace '^\w+=','') }
Write-Host "REMEDIATED: Canonical ACL overlap on OU: $ouLeaf" -ForegroundColor Green
$printedOverlapNotice = $true
}
Copilot AI review requested due to automatic review settings August 24, 2026 07:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

tests/Unit.CanonicalAclRepair.Tests.ps1:334

  • In this overlap context, the last two tests still pass -WarningVariable warnVar 3>$null, even though overlap notices are no longer emitted on the warning stream. Keeping the redirection here can mask unexpected warning-stream output from future changes and makes the tests inconsistent with the new contract (Warnings array on the result).
            (($result.Warnings) -join ' ') | Should -Match 'overlap|S-1-5-11|Authenticated'
        }

        It "Still repairs (IsCanonical=true) despite the overlap warning" {
            $result = Repair-TierModelCanonicalAcl -SecurityDescriptorBytes $script:OverlapInputBytes -WarningVariable warnVar 3>$null

Comment on lines +199 to +200
$ouLeaf = if ([string]::IsNullOrEmpty($DistinguishedName)) { $DistinguishedName } else { (($DistinguishedName -split ',')[0] -replace '^\w+=','') }
Write-Host "REMEDIATED: Canonical ACL overlap on OU: $ouLeaf" -ForegroundColor Green
@VAsHachiRoku
Joel Platek (VAsHachiRoku) merged commit d2b56de into main Aug 24, 2026
10 checks passed
@VAsHachiRoku
Joel Platek (VAsHachiRoku) deleted the fix/canonical-remediation-message branch August 24, 2026 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants